package com.easwift.qsp.das;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;

public class ServerSocketThread extends Thread{

	private ServerSocket serverSocket;

	public ServerSocketThread(ServerSocket serverSocket) {
		super();
		this.serverSocket = serverSocket;

	}

	@Override
	public void run(){
		try(ServerSocket serverSocket = this.serverSocket){
			while(true){
				////建立接收Socket，阻塞响应 等待客户端响应
				Socket socket = serverSocket.accept();
				System.out.println(String.format("连接时间：%s\t发送方：%s:%s\t发送包：%s",new Date(),socket.getInetAddress(),socket.getPort(),socket.hashCode()));
				new SocketThread(socket).start();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}

}
